{% load custom_tags %}
<div id="finding-{{ finding.id }}" scoring-type="DREAD" class="finding" finding-severity="{{ finding.severity }}">
    <div>
        {% if first %}
            {% include 'componentTemplates/Heading.html' with classes="finding-heading" %}
        {% endif %}
    </div>
    <div class="finding-table">
        <div class='finding-header'>
            <div class='finding-severity background-color-severity'>
                {{ finding.score }}
                <br />
                {{ finding.severity }}
            </div>
            <div class='finding-title'>
                [{{ finding.number }}] {{ finding.name }}
            </div>
        </div>
        <div class='finding-content'>
            <div class='finding-content-header'>
                Category
            </div>
            <div class='finding-content-body' style='font-weight: bold'>
                {{ finding.categoryFull }}
            </div>
        </div>
        {% if finding.affectedResources %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                Affected Resources
            </div>
            <div class='finding-content-body'>
                {% markdown finding.affectedResources %}
            </div>
        </div>
        {% endif %}
        {% if finding.dreadImpact %}
        <div class='finding-content'>
            <div class='finding-content-header dread-impact'>
                Impact
            </div>
            <div class='finding-content-body dread-impact'>
                <ul>
                    {% for i in finding.impact %}
                    <li>{{ i }}</li>
                    {% endfor %}
                </ul>
            </div>
        </div>
        {% endif %}
        {% if finding.description %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                Description
            </div>
            <div class='finding-content-body'>
                {% markdown finding.description %}
            </div>
        </div>
        {% endif %}
        {% if finding.background %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                Background
            </div>
            <div class='finding-content-body'>
                {% markdown finding.background %}
            </div>
        </div>
        {% endif %}
        {% if finding.descDamage %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                Damage ({{ finding.dread.dict.dreadDamage }})
            </div>
            <div class='finding-content-body'>
                {% markdown finding.descDamage %}
            </div>
        </div>
        {% endif %}
        {% if finding.descReproducibility %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                Reproducibility ({{ finding.dread.dict.dreadReproducibility }})
            </div>
            <div class='finding-content-body'>
                {% markdown finding.descReproducibility %}
            </div>
        </div>
        {% endif %}
        {% if finding.descExploitability %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                Exploitability ({{ finding.dread.dict.dreadExploitability }})
            </div>
            <div class='finding-content-body'>
                {% markdown finding.descExploitability %}
            </div>
        </div>
        {% endif %}
        {% if finding.descAffectedUsers %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                Affected Users ({{ finding.dread.dict.dreadAffectedUsers }})
            </div>
            <div class='finding-content-body'>
                {% markdown finding.descAffectedUsers %}
            </div>
        </div>
        {% endif %}
        {% if finding.descDiscoverability %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                Discoverability ({{ finding.dread.dict.dreadDiscoverability }})
            </div>
            <div class='finding-content-body'>
                {% markdown finding.descDiscoverability %}
            </div>
        </div>
        {% endif %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                Score
            </div>
            <div class='finding-content-body dread-category bold'>(
                D:{{ finding.dread.dict.dreadDamage }} + 
                R:{{ finding.dread.dict.dreadReproducibility }} + 
                E:{{ finding.dread.dict.dreadExploitability }} + 
                A:{{ finding.dread.dict.dreadAffectedUsers }} + 
                D:{{ finding.dread.dict.dreadDiscoverability }}
                ) / 5 = {{ finding.score }} ({{ finding.severity }}) </div>
        </div>
        {% if finding.remediation %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                Remediation
            </div>
            <div class='finding-content-body'>
                {% markdown finding.remediation %}
            </div>
        </div>
        {% endif %}
        {% if finding.references %}
        <div class='finding-content'>
            <div class='finding-content-header'>
                References
            </div>
            <div class='finding-content-body'>
                {% markdown finding.references %}
            </div>
        </div>
        {% endif %}
    </div>
</div>
{% for figure in finding.figures_ending %}
    {% include 'reportTemplates/figure.html' with figure=figure %}
    {% endfor %}
